<?php


include '../test_upload_pic.php';
session_start();
ob_start();
date_default_timezone_set('PRC');
//var_dump($_POST);exit;
$error='';
$name = $_POST['name'];
$password = $_POST['password'];
$age = $_POST['age'];
$gender = $_POST['gender'];



	//将内容插入到数据库中
	if(empty($error)){
		include '../config.php';
		$link=mysql_connect(HOST,DBUSER,DBPASS) or die('数据库连接失败');
		mysql_select_db(DBNAME,$link);
		mysql_set_charset('utf8');
		
		if(empty($error)){
			$sql= "update t_user set  name='".$name."',
			password='".$password."',
			gender='".$gender."', age='".$age."' where id=".$_POST['id'];
			$result=mysql_query($sql);
		}
		mysql_close($link);
	}
	//错误跳转
	if(empty($error)){
		header('Location:userList.php');
	}else{
		header('Location:userAdd.php?error='.$error);
	}
	ob_end_flush();
	?>